package sdk;

import java.util.ArrayList;
import java.util.Arrays;


public class Square
{
	public  String[][] square = new String[3][3];
	private int xPos;
	private int yPos;

	public Square(String[][] square)
	{
		this.square = square;
	}
	
	public Square()
	{
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				square[i][j]="*";
			}
		}
	}
	
	public String getValue(int i, int j){
		return square[i][j];
	}
	
	public String[] getLineArray(){
		String[] res = new String[9];
		int k=0;
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				res[k++]=square[i][j];
			}
		}
		return res;
	}

	
	public int getxPos()
	{
		return xPos;
	}

	public void setxPos(int xPos)
	{
		this.xPos = xPos;
	}

	public int getyPos()
	{
		return yPos;
	}

	public void setyPos(int yPos)
	{
		this.yPos = yPos;
	}

	@Override
	public String toString()
	{
		String res="+---+";
		for(int i=0;i<3;i++){
			res=res+"\n|";
			for(int j=0;j<3;j++){
				res=res+square[i][j];
			}
			res=res+"|";
		}
		res=res+"\n+---+";
		return res;
	}
	
	public String getLine(){
		String res="";
		ArrayList<String> arraySDK = new ArrayList<String>(Arrays.asList(getLineArray()));
		for(int i=0;i<9;i++){
			if (!arraySDK.contains((i+1)+"")){
				res=res+(i+1);
			}else{
				res=res+".";
			}

		}
		return res;
	}
	
	

}
